package net.esj.basic.dao.jdbc.jpa.support;

import java.sql.ResultSet;
import java.sql.SQLException;

import net.esj.basic.dao.jdbc.jpa.ResultSetExtractor;


public class SingleColumnResultSetExtractor implements ResultSetExtractor{

	private int columnIndex = 1;
	public SingleColumnResultSetExtractor() {
	}
	public SingleColumnResultSetExtractor(int columnIndex) {
		this.columnIndex = columnIndex;
	}
	public Object extractData(ResultSet resultset) {
		try {
			return resultset.getObject(columnIndex);
		} catch (SQLException e) {
			throw new RuntimeException(e.getMessage(), e);
		}
	}

}
